import { CellRenderer } from "../../../../../../fl/controls/listClasses/CellRenderer";
import { ObjCreate } from "../../../common/ObjCreate";
import { Dispatcher } from "../../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../../events/DataEvent";
import { EventName } from "../../../../mvc/EventName";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
//class SkillRuneHandbookSubRender
    
    export  class SkillRuneHandbookSubRender extends CellRenderer
    {
        constructor()
        {
            super();
            this.setSize(160, 19);
            this.initStyle();
            this.txt = ObjCreate.createGTextField("", 0, 2, 150, 20, this);
            var loc1=this.txt.defaultTextFormat;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this.txt.defaultTextFormat = loc1;
            this.addEventListener(flash.events.MouseEvent.CLICK, this.clickHandler);
            this.addEventListener(flash.events.MouseEvent.DOUBLE_CLICK, this.clickHandler);
            this.addEventListener(flash.events.Event.CHANGE, this.selectedChangeHandler);
            this.buttonMode = true;
            return;
        }

        /* internal  */clickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RuneClickRuneSubTypes, this._name));
            return;
        }

        /* internal  */selectedChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=this.selected;
            var loc2=16711427;
            if (!loc1) 
            {
                loc2 = 10417146;
            }
            this.txt.textColor = loc2;
            return;
        }

        /* internal  */initStyle(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap(ImagesConst.FightingStrgBg));
            this.setStyle("overSkin", GlobalClass.getBitmap(ImagesConst.FightingStrgBg));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap(ImagesConst.FightingStrgBg));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap(ImagesConst.FightingStrgBg));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap(ImagesConst.FightingStrgBg));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            this._name = String(arg1);
            this.txt.text = this._name;
            return;
        }

        /* internal */ /* var */txt: GTextFiled;

        /* internal */ /* var */_name: string;
    }
